package cn.edu.fudan.dsm.MultiIndexes;

import cn.edu.fudan.dsm.MultiIndexes.operator.TimeSeriesOperator;
import cn.edu.fudan.dsm.MultiIndexes.operator.file.TimeSeriesFileOperator;

import java.io.*;
import java.util.List;

public class Read2Csv {
    public static void main(String[] args){
        try {
            long fileLength = 1000000000;
            int seriesLength = 10000;

            File wfile = new File("0.csv");
            BufferedWriter bw = new BufferedWriter(new FileWriter(wfile, true));
            //FileOutputStream fos = new FileOutputStream(wfile);
            TimeSeriesOperator timeSeriesOperator = new TimeSeriesFileOperator("files/data/1000000000", fileLength, seriesLength, false);

            for(long i = 0; i < 1; i++){
                float ex = 0;
                float ex2 = 1;
                List<Double> ts = timeSeriesOperator.readTimeSeries(i * seriesLength, seriesLength);
                for(int j = 0; j < ts.size(); j++){
                    bw.write(ts.get(j) + "\n");
                }
                //bw.write(ts.get(ts.size() - 1) + "");
            }
            //fos.close();
            bw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
